oo::class create EditMenu {
    superclass AppMenu
    variable Menu Label NotebookObj Notebook

    constructor {menubar} {
        next $menubar edit
    }

    method createMenu {} {
        foreach row {
            {command {Copy C-c 0 {}}}
            {command {Cut C-x 1 {}}}
            {command {Paste C-v 0 {}}}
            {command {{Select All} C-slash 0 {}}}
            {command {{Del prevWord} C-BackSpace {} deletePreviousWord}}
            {command {{Del nextWord} C-Delete {} deleteNextWord}}
            {separator {}}
            {command {Undo C-z 0 {}}}
            {command {Redo C-y 0 {}}}
            {separator {}}
            {command {Mark C-m 0 {}}}
            {command {Unmark Escape 1 {}}}
            {separator {}}
            {command {Indent Tab {} {}}}
            {command {Complete C-Return {} {}}}
        } {
            my createItem $row
        }
    }

    method deletePreviousWord {} {
        set padWidget [my getCurrentPadWidget]
        set wordHead [_$padWidget search -backward -regexp {\w+} insert 1.0]
        if {$wordHead != {}} {
            $padWidget delete $wordHead insert
        }
    }

    method deleteNextWord {} {
        set padWidget [my getCurrentPadWidget]
        set wordEnd [_$padWidget search -regexp -nolinestop {\W|\s} insert end]
        if {$wordEnd == {}} { set wordEnd end }
        $padWidget delete insert $wordEnd
    }
}